From d52479c162f4798a7630b8308949a21d72090fb5 Mon Sep 17 00:00:00 2001
From: Pinapelz <yukais@pinapelz.com>
Date: Tue, 1 Jul 2025 19:18:34 -0700
Subject: middleware: allow for EN TL in opengraph

---
 middleware/src/app/[gameName]/page.tsx | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'middleware/src/app/[gameName]/page.tsx')

diff --git a/middleware/src/app/[gameName]/page.tsx b/middleware/src/app/[gameName]/page.tsx
index 5a4f0ff..dc070db 100644
--- a/middleware/src/app/[gameName]/page.tsx
+++ b/middleware/src/app/[gameName]/page.tsx
@@ -11,8 +11,8 @@ export async function generateMetadata({
   const resolvedSearchParams = await searchParams;
   let gameName = resolvedParams.gameName || "news";
   const postId = resolvedSearchParams.post as string | undefined;
+  const lang = resolvedSearchParams.lang as string | undefined;
   const apiUrlBase = process.env.NEXT_PUBLIC_API_URL;
-  const mainNewsUrl = process.env.NEXT_PUBLIC_MAIN_NEWS_URL;
 
   if (!postId) {
     return {
@@ -42,6 +42,14 @@ export async function generateMetadata({
     if (!matchingPost) {
       return { title: "Post not found" };
     }
+    if (lang === "en"){
+      if(matchingPost.en_headline !== null){
+        matchingPost.headline = matchingPost.en_headline;
+      }
+      if(matchingPost.en_content !== null){
+        matchingPost.content = matchingPost.en_content;
+      }
+    }
     if (!matchingPost.headline) {
       matchingPost.headline = matchingPost.content;
     }
-- 
cgit v1.2.3

